#!/usr/bin/perl
#Removes newlines from lexicon.tdl so it is one line for each entry

use strict;
use warnings;
use encoding 'utf8';

#Open file for writing
open TRIMMED, ">lexicon_trim.tdl" or die $!;
open LEXICON,  "<:utf8", "lexicon.tdl" or die $!;

my $count=0;
while (<LEXICON>){
	if($_ =~ m/^(.*)\s\:=\s([ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-]+)\s/){
	print $1."\t".$2."\n";	
		print TRIMMED $1."\t".$2."\n";
	}		
	$count++;
	#print $count."\n"
}
close TRIMMED;
close LEXICON;
print "All done!\n";